<?

	/*

		1: not logged in,	not me,	favorite
		2: not logged in,	not me,	favorite foreign
		3: logged in,		not me,	favorite
		4: logged in,		not me,	favorite foreign
		5: logged in,		me,		favorite
		6: logged in,		me,		favorite foreign

	*/

	if( $_REQUEST[ "JO_favorite" ] ) $_REQUEST[ "JO_favorite_key" ] = $_REQUEST[ "JO_favorite" ];

	if( empty( $_REQUEST[ "JO_account_key" ] ) && empty( $_REQUEST[ "JO_favorite_key" ] ) && empty( $_SESSION[ "JO_account_key" ] ) ) JO_location( "." );

	if( $_REQUEST[ "JO_favorite_key" ] ) {

		$query = "
			SELECT	`account`,
					`subject`,
					`type`,
					`foreign`,
					`public`,
					( SELECT `name` FROM `account` WHERE `account`.`key` = `favorite`.`account` ) AS `name`
			FROM	`favorite`
			WHERE	`key` = '" . $_REQUEST[ "JO_favorite_key" ] . "'
		";

		$recordSet = JO_query( $query );

		if( $recordSet -> num_rows ) $record = $recordSet -> fetch_array( );

		if( $record[ "account" ] != $_SESSION[ "JO_account_key" ] && ! $record[ "public" ]	) JO_location( "." );
		if( $record[ "account" ] != $_SESSION[ "JO_account_key" ]							) $name = $record[ "name" ];

		$subject	= $record[ "subject"	];
		$type		= $record[ "type"		];
		$foreign	= $record[ "foreign"	];

	} else if( $_REQUEST[ "JO_account_key" ] && $_REQUEST[ "JO_account_key" ] != $_SESSION[ "JO_account_key" ] ) {

		$query = "
			SELECT	`name`
			FROM	`account`
			WHERE	`key` = '" . $_REQUEST[ "JO_account_key" ] . "'
		";

		$recordSet = JO_query( $query );

		if( $recordSet -> num_rows ) $record = $recordSet -> fetch_array( );

		$name = $record[ "name" ];

	}

?>



<script>



	function JO_favorite_checkbox( ) {

		for( i = 0; i < JO_favorite_count; i ++ ) document.getElementById( "JO_favorite_checkbox_" + i ).checked = document.getElementById( "JO_favorite_checkbox" ).checked;

	}



	function JO_favorite_insert( ) {

		document.getElementById( "JO_favorite_query"	).value			= "favorite_insert"
		document.getElementById( "JO_favorite_key"		).value			= "";
		document.getElementById( "JO_favorite_status"	).innerHTML		= "<?= JO( array(
			"EN" => "Insert",
			"KO" => "입력",
			"VI" => "Nhập"
		) ) ?>";
		document.getElementById( "JO_favorite_subject"	).value			= "";
		document.getElementById( "JO_favorite_type"		).value			= "";
		document.getElementById( "JO_favorite_type"		).style.display	= "block";
		document.getElementById( "JO_favorite_button"	).setAttribute( "title", "Insert This" );

	}

	function JO_favorite_update( key, subject ) {

		document.getElementById( "JO_favorite_query"	).value			= "favorite_update"
		document.getElementById( "JO_favorite_key"		).value			= key;
		document.getElementById( "JO_favorite_status"	).innerHTML		= "<?= JO( array(
			"EN" => "Update",
			"KO" => "변경",
			"VI" => "Thay Đổi"
		) ) ?>";
		document.getElementById( "JO_favorite_subject"	).value			= subject;
		document.getElementById( "JO_favorite_subject"	).select( );
		document.getElementById( "JO_favorite_type"		).style.display	= "none";
		document.getElementById( "JO_favorite_button"	).setAttribute( "title", "Update This" );

	}



	function JO_favorite_delete( key ) {

		if( ! key ) {

			key = "";

			for( i = 0; i < JO_favorite_count; i ++ ) if( document.getElementById( "JO_favorite_checkbox_" + i ).checked ) key += document.getElementById( "JO_favorite_checkbox_" + i ).value + ";"

		}

		if( ! key ) {

			alert( "<?= JO( array(
					"EN" => "Please check the items that you want to delete.",
					"KO" => "변경",
					"VI" => "Xin hãy đánh dấu vào những mặt hàng bạn muốn xóa."
				) ) ?>" );


			return false;

		}

		<? if( empty( $_REQUEST[ "JO_favorite_key" ] ) ) { ?> 

			document.getElementById( "JO_integration_asynchronous" ).src = "JO_05_execution.php?JO_query=favorite_delete&JO_favorite_key=" + key;

		<? } else { ?>

			document.getElementById( "JO_integration_asynchronous" ).src = "JO_05_execution.php?JO_query=favorite_delete&JO_favorite_key=<?= $_REQUEST[ "JO_favorite_key" ] ?>&JO_favorite_foreign=" + key;

		<? } ?>

	}



</script>



<div class="JO_page">

	<h1><?= JO( array(
		"EN" => "Favorite",
		"KO" => "즐겨찾기",
		"VI" => "Yêu Thích"
	) ) ?></h1>

	<h2>&nbsp;</h2>

	<h3>&nbsp;</h3>

</div>



<div class="JO_relative" style="width: 960px;">



	<!-- Left -->

		<div class="JO_left">

			<div style="width: 240px;">&nbsp;</div>

			<!--<div class="JO_box_240">

				<h1><?= JO( array(
					"EN" => "I want to...",
					"KO" => "내가 원하는 것은...",
					"VI" => "Tôi muốn..."
				) ) ?></h1>

				<? /*

					Copy to My Favorite
					Delete Every Favorite
					Insert a Favorite

					Share to Facebook
					Share to Twitter

				*/ ?>

			</div>-->

		</div>



	<!-- Body -->

		<div class="JO_left">



			<div class="JO_bar_720">



				<? if( empty( $_REQUEST[ "JO_favorite_key" ] ) ) { ?>

					<h1><?= JO( array(
						"EN" => ( $name ? $name ."'s" : "My" ) . " Favorite",
						"KO" => ( $name ? $name ."의" : "내" ) . " 즐겨찾기",
						"VI" => ( $name ? "Mục Yêu Thích Của ".$name  : "Mục Yêu Thích Của Tôi" )
					) ) ?></h1>

				<? } else { ?>

					<h1><?= $subject ?></h1>

					<h2><a href="?JO_unit=13_favorite<?= $name ? "&JO_account_key=" . $_REQUEST[ "JO_account_key" ] : "" ?>"><?= JO( array(
						"EN" => ( $name ? $name ."'s" : "My" ) . " Favorite",
						"KO" => ( $name ? $name ."의" : "내" ) . " 즐겨찾기",
						"VI" => ( $name ? $name ."'s" : "My" ) . " Favorite"
					) ) ?></a></h2>

				<? } ?>



				<div>

					<table>

						<tr>



							<!-- Checkbox -->

								<th
									class		= "JO_top"
									style		= "width: 4px;"
								><span
									class		= "JO_relative"
								><input
									type		= "checkbox"
									id			= "JO_favorite_checkbox"
									class		= "JO_checkbox"
									onchange	= "JO_favorite_checkbox( );"
								/></span></th>



							<? if( empty( $name ) ) { ?>

								<!-- Priority -->

									<th style="width: 61px;"><?= JO( array(
										"EN" => "Priority",
										"KO" => "중요도",
										"VI" => "Ưu Tiên",
									) ) ?></th>

							<? } ?>



							<? if(	empty( $type )		||
									$type == "music"	||
									$type == "album"	||
									$type == "video"	||
									$type == "show"		||
									$type == "drama"	||
									$type == "movie"	) { ?>

								<!-- Subject -->

									<th><?= JO( array(
										"EN" => "Subject",
										"KO" => "제목",
										"VI" => "Chủ đề",
									) ) ?></th>

							<? } ?>



							<? if( empty( $type ) ) { ?>

								<!-- Type -->

									<th style="width: 61px;"><?= JO( array(
										"EN" => "Type",
										"KO" => "유형",
										"VI" => "Loại",
									) ) ?></th>

								<!-- Amount -->

									<th style="width: 45px;"><?= JO( array(
										"EN" => "Amount",
										"KO" => "수량",
										"VI" => "Tổng",
									) ) ?></th>

							<? } ?>



							<? if( empty( $type ) && empty( $name ) ) { ?>

								<!-- Public -->

									<th
										style	= "width: 12px;"
									><img
										src		= "JO_80_image/JO_24_icon_public_on.png"
										title	= "<?= JO( array(
										"EN" => "Private & Public",
										"KO" => "수량",
										"VI" => "Tùy chọn riêng tư",
									) ) ?>"
										class	= "JO_icon"
									/></th>

								<!-- Update -->

									<th
										style	= "width: 12px;"
									><img
										src		= "JO_80_image/JO_22_icon_update_on.png"
										title	= "<?= JO( array(
										"EN" => "Update & Insert",
										"KO" => "수량",
										"VI" => "Cập Nhật & Nhập",
									) ) ?>"
										class	= "JO_icon"
									/></th>

							<? } ?>



							<? if(	$type == "artist"	||
									$type == "music"	||
									$type == "album"	||
									$type == "video"	||
									$type == "show"		||
									$type == "drama"	||
									$type == "movie"	) { ?>

								<!-- Artist -->

									<th><?= JO( array(
										"EN" => "Artist",
										"KO" => "아티스트",
										"VI" => "Nghệ sĩ",
									) ) ?></th>

							<? } ?>



							<? if(	$type == "music"	||
									$type == "album"	||
									$type == "video"	||
									$type == "show"		||
									$type == "drama"	||
									$type == "movie"	) { ?>

								<!-- Stream -->

									<th
										style		= "width: 12px;"
									><a
										href		= "#this"
										title		= "Stream Every Checked Item"
										onclick		= ""
									><img
										src			= "JO_80_image/JO_31_icon_stream_off.png"
										style		= "width: 9px; height: 9px;"
										onmouseover	= "this.src='JO_80_image/JO_31_icon_stream_on.png';"
										onmouseout	= "this.src='JO_80_image/JO_31_icon_stream_off.png';"
									/></a></th>

							<? } ?>



							<? if(	$type == "music"	||
									$type == "album"	) { ?>

								<!-- Download -->

									<th
										style		= "width: 12px;"
									><a
										href		= "#this"
										title		= "<?= JO( array(
										"EN" => "Delete Every Checked Item",
										"KO" => "아티스트",
										"VI" => "Xóa Những Mục Đã Đánh Dấu",
									) ) ?>"
										onclick		= ""
									><img
										src			= "JO_80_image/JO_32_icon_download_off.png"
										style		= "width: 9px; height: 9px;"
										onmouseover	= "this.src='JO_80_image/JO_32_icon_download_on.png';"
										onmouseout	= "this.src='JO_80_image/JO_32_icon_download_off.png';"
									/></a></th>

							<? } ?>



							<? if( empty( $name ) ) { ?>

								<!-- Delete -->

									<th
										style		= "width: 12px;"
									><a
										href		= "#this"
										title		= "<?= JO( array(
										"EN" => "Delete Every Checked Item",
										"KO" => "아티스트",
										"VI" => "Xóa Những Mục Đã Đánh Dấu",
									) ) ?>"
										onclick		= "JO_favorite_delete( );"
									><img
										src			= "JO_80_image/JO_23_icon_delete_off.png"
										class		= "JO_icon"
										onmouseover	= "this.src='JO_80_image/JO_23_icon_delete_on.png';"
										onmouseout	= "this.src='JO_80_image/JO_23_icon_delete_off.png';"
									/></a></th>

							<? } ?>



							<? if( $name ) { ?>

								<!-- Favorite -->

									<th	
										style		= "width: 12px;"
									><a
										href		= "#this"
										title		= "<?= JO( array(
										"EN" => "Put Every Checked Item to My Favorite",
										"KO" => "아티스트",
										"VI" => "Thêm Những Mục Đã Đánh Dấu Vào Mục Yêu Thích
										",
									) ) ?>"
										onclick		= ""
									><img
										src			= "JO_80_image/JO_34_icon_favorite_off.png"
										class		= "JO_icon"
										onmouseover	= "this.src='JO_80_image/JO_34_icon_favorite_on.png';"
										onmouseout	= "this.src='JO_80_image/JO_34_icon_favorite_off.png';"
									/></a></th>

							<? } ?>



						</tr>



						<!-- List -->

							<?

								if( empty( $_REQUEST[ "JO_favorite_key" ] ) ) {

									$query = "
										SELECT		`key`,
													`priority`,
													`subject`,
													`type`,
													`foreign`,
													`public`
										FROM		`favorite`
										WHERE		`delete` IS NULL
										AND			`account`	= '" . ( $_REQUEST[ "JO_account_key" ] ? $_REQUEST[ "JO_account_key" ] : $_SESSION[ "JO_account_key" ] ) . "'
									" . ( $name ? "AND `public` = TRUE" : "" ) . "
										ORDER BY	`priority` DESC
									";

								} else {

									if( $type == "artist" ) {

										$query = "
											SELECT		`key`,
														`name`
											FROM		`artist`
										";

									} else if ( $type == "music" || $type == "video" ) {

										$query = "
											SELECT		`key`,
														`subject`,
														`JC_FK_artist.name` ( `artist` ) AS `artist FKF`
											FROM		`" . $type . "`
										";

									} else if( $type == "album" || $type == "show" || $type == "drama" || $type == "movie" ) {

										$query = "
											SELECT		`key`,
														`subject`,
														`JC_FK_artist.name` ( `artist` ) AS `artist FKF`
											FROM		`album`
										";

									}

									$where	= "";
									$case	= "";
									$count	= 0;

									foreach( explode( "\r\n", $foreign ) as $value ) if( $value ) {
										$where	.= "	OR `key` = '" . $value . "'";
										$case	.= "	WHEN '" . $value . "' THEN " . ++ $count;
									}

									$query .="
										WHERE		`delete` IS NULL
										AND (		FALSE
									" . $where . "
										)
										ORDER BY	CASE `key`
									" . $case . "
													END
									";

								}

								$recordSet = JO_query( $query );

								$count = 0;

								if( $recordSet -> num_rows ) while( $record = $recordSet -> fetch_array( ) ) {

							?>

								<tr>



									<!-- Checkbox -->

										<td><span
											class	= "JO_relative"
										><input
											type	= "checkbox"
											id		= "JO_favorite_checkbox_<?= $count ++ ?>"
											value	= "<?= $record[ "key" ] ?>"
											class	= "JO_checkbox"
										/></span></td>



									<? if( empty( $name ) ) { ?>

										<!-- Priority -->

											<td>

												<? if( $count == 1 ) { ?>

													<img
														src		= "JO_80_image/JO_00_blank.gif"
														style	= "width: 13px; height: 12px;"
													/>

													<img
														src		= "JO_80_image/JO_00_blank.gif"
														style	= "width: 13px; height: 12px;"
													/>

												<? } else { ?>

													<a
														href		= "JO_05_execution.php?JO_query=favorite_update&JO_favorite_key=<?= $_REQUEST[ "JO_favorite_key" ] ? $_REQUEST[ "JO_favorite_key" ] : $record[ "key" ] ?><?= $_REQUEST[ "JO_favorite_key" ] ? "&JO_favorite_foreign=" . $record[ "key" ] : "" ?>&JO_favorite_move=top"
														target		= "JO_integration_asynchronous"
														title		= "<?= JO( array(
																	"EN" => "Move This To Top",
																	"KO" => "아티스트",
																	"VI" => "Di Chuyển Lên Trên Cùng",
																) ) ?>"
													><img
														src			= "JO_80_image/JO_26_icon_top_off.png"
														class		= "JO_icon"
														style		= "margin-right: 1px"
														onmouseover	= "this.src='JO_80_image/JO_26_icon_top_on.png';"
														onmouseout	= "this.src='JO_80_image/JO_26_icon_top_off.png';"
													/></a>

													<a
														href		= "JO_05_execution.php?JO_query=favorite_update&JO_favorite_key=<?= $_REQUEST[ "JO_favorite_key" ] ? $_REQUEST[ "JO_favorite_key" ] : $record[ "key" ] ?><?= $_REQUEST[ "JO_favorite_key" ] ? "&JO_favorite_foreign=" . $record[ "key" ] : "" ?>&JO_favorite_move=up"
														target		= "JO_integration_asynchronous"
														title		= "<?= JO( array(
																	"EN" => "Move This Up",
																	"KO" => "아티스트",
																	"VI" => "Di Chuyển Lên Trên",
																) ) ?>"
													><img
														src			= "JO_80_image/JO_27_icon_up_off.png"
														class		= "JO_icon"
														style		= "margin-right: 1px"
														onmouseover	= "this.src='JO_80_image/JO_27_icon_up_on.png';"
														onmouseout	= "this.src='JO_80_image/JO_27_icon_up_off.png';"
													/></a>


												<? } ?>

												<? if( $record[ "priority" ] || $count < substr_count( $foreign, "\r\n" ) ) { ?>

													<a
														href		= "JO_05_execution.php?JO_query=favorite_update&JO_favorite_key=<?= $_REQUEST[ "JO_favorite_key" ] ? $_REQUEST[ "JO_favorite_key" ] : $record[ "key" ] ?><?= $_REQUEST[ "JO_favorite_key" ] ? "&JO_favorite_foreign=" . $record[ "key" ] : "" ?>&JO_favorite_move=down"
														target		= "JO_integration_asynchronous"
														title		= "<?= JO( array(
																	"EN" => "Move This Down",
																	"KO" => "아티스트",
																	"VI" => "Di Chuyển Xuống Dưới",
																) ) ?>"
													><img
														src			= "JO_80_image/JO_28_icon_down_off.png"
														class		= "JO_icon"
														style		= "margin-right: 1px"
														onmouseover	= "this.src='JO_80_image/JO_28_icon_down_on.png';"
														onmouseout	= "this.src='JO_80_image/JO_28_icon_down_off.png';"
													/></a>

													<a
														href		= "JO_05_execution.php?JO_query=favorite_update&JO_favorite_key=<?= $_REQUEST[ "JO_favorite_key" ] ? $_REQUEST[ "JO_favorite_key" ] : $record[ "key" ] ?><?= $_REQUEST[ "JO_favorite_key" ] ? "&JO_favorite_foreign=" . $record[ "key" ] : "" ?>&JO_favorite_move=bottom"
														target		= "JO_integration_asynchronous"
														title		= "<?= JO( array(
																	"EN" => "Move This To Bottom",
																	"KO" => "아티스트",
																	"VI" => "Di Chuyển Xuống Dưới Cùng",
																) ) ?>"
													><img
														src			= "JO_80_image/JO_29_icon_bottom_off.png"
														class		= "JO_icon"
														onmouseover	= "this.src='JO_80_image/JO_29_icon_bottom_on.png';"
														onmouseout	= "this.src='JO_80_image/JO_29_icon_bottom_off.png';"
													/></a>

												<? } ?>

											</td>

									<? } ?>



									<? if(	$type == "music"	||
											$type == "video"	) { ?>

										<!-- Subject -->

											<td><?= $record[ "subject" ] ?></td>

									<? } ?>



									<? if(	$type == "album"	||
											$type == "show"		||
											$type == "drama"	||
											$type == "movie"	) { ?>

										<!-- Subject -->

											<td><a href="?JO_album=<?= $record[ "key" ] ?>"><?= $record[ "subject" ] ?></a></td>

									<? } ?>



									<? if( empty( $type ) ) { ?>

										<!-- Subject -->

											<td><a
												id		= "JO_favorite_subject_<?= $record[ "key" ] ?>"
												href	= "?JO_unit=13_favorite&JO_favorite_key=<?= $record[ "key" ] ?><?= $name ? "&JO_account_key=" . $_REQUEST[ "JO_account_key" ] : "" ?>"
											><?= $record[ "subject" ] ?></a></td>

										<!-- Type -->

											<td><?= $JO[ $record[ "type" ] ] ?></td>

										<!-- Item -->

											<td class="JO_right"><?= substr_count( $record[ "foreign" ], "\r\n" ) ?></td>

									<? } ?>



									<? if( empty( $type ) && empty( $name ) ) { ?>

										<!-- Public -->

											<td><a
												href		= "JO_05_execution.php?JO_query=favorite_update&JO_favorite_key=<?= $record[ "key" ] ?>&JO_favorite_public=<?= $record[ "public" ] ? "false" : "true" ?>"
												title		= "Change This to <?= $record[ "public" ] ? "Private" : "Public" ?>"
											><img
												src			= "JO_80_image/JO_24_icon_public_<?= $record[ "public" ] ? "on" : "off" ?>.png"
												class		= "JO_icon"
												onmouseover	= "this.src='JO_80_image/JO_24_icon_public_<?= $record[ "public" ] ? "off" : "on" ?>.png';"
												onmouseout	= "this.src='JO_80_image/JO_24_icon_public_<?= $record[ "public" ] ? "on" : "off" ?>.png';"
											/></a></td>

										<!-- Update -->

											<td><a
												href		= "#this"
												title		= "<?= JO( array(
																	"EN" => "Update This",
																	"KO" => "아티스트",
																	"VI" => "Cập Nhật",
																) ) ?>"
												onclick		= "JO_favorite_update( '<?= $record[ "key" ] ?>', document.getElementById( 'JO_favorite_subject_<?= $record[ "key" ] ?>' ).innerHTML );"
											><img
												src			= "JO_80_image/JO_22_icon_update_off.png"
												class		= "JO_icon"
												onmouseover	= "this.src='JO_80_image/JO_22_icon_update_on.png';"
												onmouseout	= "this.src='JO_80_image/JO_22_icon_update_off.png';"
											/></a></td>

									<? } ?>



									<? if( $type == "artist" ) { ?>

										<!-- Artist -->

											<td><a href="?JO_artist=<?= $record[ "key" ] ?>"><?= $record[ "name" ] ?></a></td>

									<? } ?>



									<? if(
										$type == "music"	||
										$type == "album"	||
										$type == "video"	||
										$type == "show"		||
										$type == "drama"	||
										$type == "movie"
									) { ?>

										<!-- Artist -->

											<td><? foreach( explode( "\r\n", $record[ "artist FKF" ] ) as $value ) echo "<a href='?JO_artist=" . substr( $value, 0, strpos( $value, ":" ) ) . "'>" . substr( $value, strpos( $value, ":" ) + 2 ) . "</a><br />"; ?></td>

									<? } ?>



									<? if(
										$type == "music"	||
										$type == "album"	||
										$type == "video"	||
										$type == "show"		||
										$type == "drama"	||
										$type == "movie"
									) { ?>

										<!-- Stream -->

											<td
												style		= "width: 9px; vertical-align: middle;"
											><a
												href		= "#this"
												title		= "<?= JO( array(
																	"EN" => "Stream This",
																	"KO" => "아티스트",
																	"VI" => "Stream",
																) ) ?>"
												onclick		= "alert( 'Becasue of the copy right issue, this is not on the service, yet.' );"
											><img
												src			= "JO_80_image/JO_31_icon_stream_off.png"
												style		= "width: 9px; height: 9px;"
												onmouseover	= "this.src='JO_80_image/JO_31_icon_stream_on.png';"
												onmouseout	= "this.src='JO_80_image/JO_31_icon_stream_off.png';"
											/></a></td>

									<? } ?>



									<? if(
										$type == "music"	||
										$type == "album"
									) { ?>

										<!-- Download -->

											<td
												style		= "width: 9px; vertical-align: middle;"
											><a
												href		= "#this"
												title		= ""<?= JO( array(
										"EN" => "Download This",
										"KO" => "아티스트",
										"VI" => "Tải Về",
									) ) ?>""
												onclick		= "alert( 'Becasue of the copy right issue, this is not on the service, yet.' );"
											><img
												src			= "JO_80_image/JO_32_icon_download_off.png"
												style		= "width: 9px; height: 9px;"
												onmouseover	= "this.src='JO_80_image/JO_32_icon_download_on.png';"
												onmouseout	= "this.src='JO_80_image/JO_32_icon_download_off.png';"
											/></a></td>

									<? } ?>



									<? if( empty( $name ) ) { ?>

										<!-- Delete -->

											<td><a
												href		= "#this"
												title		= "<?= JO( array(
										"EN" => "Delete This",
										"KO" => "아티스트",
										"VI" => "Xóa",
									) ) ?>"
												onclick		= "JO_favorite_delete( '<?= $record[ "key" ] ?>' );"
											><img
												src			= "JO_80_image/JO_23_icon_delete_off.png"
												class		= "JO_icon"
												onmouseover	= "this.src='JO_80_image/JO_23_icon_delete_on.png';"
												onmouseout	= "this.src='JO_80_image/JO_23_icon_delete_off.png';"
											/></a></td>


									<? } ?>



									<? if( $name ) { ?>

										<!-- Favorite -->
										
											<td><a
												href		= "#this"
												title		= "<?= JO( array(
										"EN" => "Put This to My Favorite",
										"KO" => "아티스트",
										"VI" => "Thêm Vào Mục Yêu Thích",
									) ) ?>"
												onclick		= ""
											><img
												src			= "JO_80_image/JO_23_icon_favorite_off.png"
												style		= "width: 9px; height: 9px;"
												onmouseover	= "this.src='JO_80_image/JO_23_icon_favorite_on.png';"
												onmouseout	= "this.src='JO_80_image/JO_23_icon_favorite_off.png';"
											/></a></td>

									<? } ?>



								</tr>



							<? } ?>

							<script> var JO_favorite_count = <?= $count ?>; </script>



						<!-- No Result -->

							<? if( empty( $count ) ) { ?>

								<tr>
									<td
										colspan	= "<? switch( $type ) {
											case "artist":	echo $name ? 5 : 8;	break;
											case "music":	echo $name ? 5 : 8;	break;
											case "album":	echo $name ? 5 : 8;	break;
											case "video":	echo $name ? 5 : 8;	break;
											case "show":	echo $name ? 5 : 8;	break;
											case "drama":	echo $name ? 5 : 8;	break;
											case "movie":	echo $name ? 5 : 8;	break;
											default:		echo $name ? 5 : 8;	break;
										} ?>"
										class	= "JO_center"
									><?= JO( array(
										"EN" => "There is no item.",
										"KO" => "항목이 없습니다.",
										"VI" => "Chưa có mặt hàng nào."
									) ) ?></td>
								</tr>

							<? } ?>



						<!-- Insert -->

							<? if( empty( $type ) && empty( $name ) ) { ?>

								<form
									id		= "JO_favorite_insert"
									action	= "JO_05_execution.php"
									target	= "JO_integration_asynchronous"
									method	= "post"
								>

									<input type="hidden" id="JO_favorite_query"	name="JO_query"			value="favorite_insert" />
									<input type="hidden" id="JO_favorite_key"	name="JO_favorite_key"	value="" />

									<tr>

										<th
											id		= "JO_favorite_status"
											colspan	= "2"
											style	= "vertical-align: middle;"
										><?= JO( array(
											"EN" => "Insert",
											"KO" => "입력",
											"VI" => "Nhập",
										) ) ?></th>

										<td><input
											type	= "text"
											id		= "JO_favorite_subject"
											name	= "JO_favorite_subject"
											style	= "margin: 3px 0px; width: 309px;"
										/></td>

										<td
											colspan	= "3"
										><select
											id		= "JO_favorite_type"
											name	= "JO_favorite_type"
											style	= "margin: 3px 0px; width: 129px;"
										>

											<option	value=""><?= JO( array(
												"EN" => "Please select.",
												"KO" => "선택하세요.",
												"VI" => "Hãy lựa chọn."
											) ) ?></option>

											<option value="artist"	><?= $JO[ "artist"	] ?></option>
											<option value="music"	><?= $JO[ "music"	] ?></option>
											<option value="album"	><?= $JO[ "album"	] ?></option>
											<option value="video"	><?= $JO[ "video"	] ?></option>
											<option value="show"	><?= $JO[ "show"	] ?></option>
											<option value="drama"	><?= $JO[ "drama"	] ?></option>
											<option value="movie"	><?= $JO[ "movie"	] ?></option>

											<? /*

												Some categories like 'Fashion', 'Notice' & 'Magazine' are able to be managed in 'Favorite' function.
												But becasue of the development duration, these has been omitted.

												Especially 'Fashion' category needs some linked functions like 'Copy My Every Favorite to My Cart'.

											*/ ?>

										</select></td>

										<td
											style		= "padding-top: 12px;"
										><a
											href		= "#this"
											id			= "JO_favorite_button"
											title		= "<?= JO( array(
										"EN" => "Insert This",
										"KO" => "아티스트",
										"VI" => "Nhập",
									) ) ?>"
											onclick		= "document.getElementById( 'JO_favorite_insert' ).submit( );"
										><img
											src			= "JO_80_image/JO_22_icon_update_off.png"
											class		= "JO_icon"
											onmouseover	= "this.src='JO_80_image/JO_22_icon_update_on.png';"
											onmouseout	= "this.src='JO_80_image/JO_22_icon_update_off.png';"
										/></a></td>

										<td
											style		= "padding-top: 12px;"
										><a
											href		= "#this"
											title		= "<?= JO( array(
										"EN" => "Cancel This",
										"KO" => "아티스트",
										"VI" => "Hủy Bỏ",
									) ) ?>"
											onclick		= "JO_favorite_insert( );"
										><img
											src			= "JO_80_image/JO_23_icon_delete_off.png"
											class		= "JO_icon"
											onmouseover	= "this.src='JO_80_image/JO_23_icon_delete_on.png';"
											onmouseout	= "this.src='JO_80_image/JO_23_icon_delete_off.png';"
										/></a></td>

									</tr>

								</form>

							<? } ?>



					</table>

				</div>

			</div>



		</div>



</div>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               